package com.lingjtx.common.core.token;

// 操作设备平台：1-h5；2-安卓；3-iOS
public enum OperationDevice {
    H5(1, "h5"),

    ANDROID(2, "android"),

    IOS(3, "ios"),

    MINI(4, "mini-program"),

    PC(5, "pc"),

    APP_KEY(6, "app-secret")
    ;

    private int code;
    private String value;

    OperationDevice(int code, String value) {
        this.code = code;
        this.value = value;
    }

    public int getCode() {
        return code;
    }

    public String getValue() {
        return value;
    }

    public static OperationDevice of(int code) {
        for (OperationDevice device : values()) {
            if (device.getCode() == code) {
                return device;
            }
        }
        return H5;
    }

    @Override
    public String toString() {
        return this.getValue();
    }
}
